from abc import ABC, abstractmethod
from typing import Optional, Dict, Any
from .task import Task
class TaskExecutor(ABC):
    @abstractmethod
    def initialize(self):
        """Initialize the executor, for example, connecting to a service."""
        pass

    @abstractmethod
    def shutdown(self):
        """Shutdown the executor, cleaning up any resources."""
        pass

    @abstractmethod
    def invoke(self, task: Task, ctx: Optional[Dict[str, Any]] = None):
        """Invoke a task and return the result."""
        pass
